package com.juma.cartridge.retryque;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicLong;

public class RetryThreadFactory implements ThreadFactory {
    
    private String prefix;
    
    private final AtomicLong threadNumber = new AtomicLong(1);
    
    public RetryThreadFactory(String prefix) {
        this.prefix = prefix;
    }
    
    @Override
    public Thread newThread(Runnable runnable) {
        Thread thread = new Thread(runnable,"RetryQue-"+prefix+"-"+threadNumber.getAndIncrement());
        return thread;
    }

}
